package org.travel_system.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.travel_system.pojo.Favorite;

import java.util.List;


@Mapper
public interface FavoritesMapper {

    //添加收藏
    @Insert("INSERT INTO favorites (tourist_id, hotel_name, restaurant_name) VALUES (#{toursId} , #{hotelName}, #{restaurantName}) ")
    int add(Favorite favorite);

    //删除收藏
    @Delete("delete from favorites where favorite_id=#{favoritesId}")
    int delete(int favoritesId);

    //查询收藏列表
    @Select("SELECT * FROM favorites WHERE tourist_id=#{userId}")
    List<Favorite> getFavoriteList(int userId);
}
